from django.db import models
from django.contrib import admin

# Create your models here.

# Model for thumbnails/uploaded art
class Thumb(models.Model):
    title = models.CharField(max_length=100)
    image = models.ImageField(upload_to='uploads')
    description = models.TextField()
    price = models.FloatField()
    gallery = models.ForeignKey('Gallery')

    def __unicode__(self):
        return "%s ($%2.2f) %s"%(self.title,self.price,self.image)

admin.site.register(Thumb)
    
# # Used for administrative interface
# class ThumbAdmin(admin.ModelAdmin):
#     fields = ('title','image','price','gallery')
# admin.site.register(ThumbAdmin)

# Model for galleries
class Gallery(models.Model):
    title = models.CharField(max_length=100)
    date_created = models.DateTimeField(auto_now=True)
    description = models.TextField()

    def __unicode__(self):
        return "%s (%s)"%(self.title,str(self.date_created))
    
# # Used for administrative interface
# class GalleryAdmin(admin.ModelAdmin):
#     fields = ('title','description')
# admin.site.register(GalleryAdmin)

admin.site.register(Gallery)
